<template>
	<view>
		<view class="list-item" v-for="(item, index) in list" :key="index" @click="toDetail(item._id)">
			<view class="left">
				<image :src="item.image" mode="widthFix"></image>
			</view>
			<view class="right">
				<view class="title">{{ item.title }}</view>
				<view class="title">{{ item.desc }}</view>
				<view class="title">{{ item.price }}</view>
			</view>
		</view>
	</view>
</template>


<script>
	const db = uniCloud.database().collection('proGoods');
	
	
	export default {
		onLoad() {
			db.get().then(resp => {
				console.log(resp)
				this.list = resp.result.data;
			})
		},
		data() {
			return {
				list: []
			}
		},
		methods: {
			toDetail(_id) {
				uni.navigateTo({
					url: '/pages/detail/detail?_id='+ _id
				})
			}
		}
		
	}
</script>